//
//  main.cpp
//  stract函数.cpp
//
//  Created by 黄靖文 on 2018/6/6.
//  Copyright © 2018年 黄靖文. All rights reserved.
#include<stdio.h>
#include<stdlib.h>
char* strcat(char *str1,char *str2)
{
    char *str3;
    int i=0;
    int j=0;
    int k;
    int count1=0,count2=0;
    while(str1[i]!='\0')
    {
        count1++;
        i++;
    }
    while(str2[j]!='\0')
    {
        count2++;
        j++;
    }
    str3=(char*)malloc(sizeof(char)*(count1+count2+1));
    for(k=0;k<count1;k++)
    {
        str3[k]=str1[k];
    }
    for(k=0;k<count2;k++)
    {
        str3[count1+k]=str2[k];
    }
    str3[count1+count2]='\0';
    return str3;
}
int main()
{
    int i;
    char str1[10]="hello";
    char str2[10]="world";
    printf("%s",strcat(str1,str2));
    printf("\n");
    return 0;
}
